package org.agile2soft.nexoma.core.entities;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table(name = "CITIZEN_ACCESS")
@SuppressWarnings({"serial"})
public class CitizenAccess implements java.io.Serializable {

    private CitizenAccessId id;
    private String username;
    private String documentNumber;

    public String toString() {
        return String.format("[CitizenAccess %s,%s,%s]",id,username,documentNumber);
    }
    public CitizenAccess() {
    }

    public CitizenAccess(CitizenAccessId id, String username,
            String documentsNumber) {
        this.id = id;
        this.username = username;
        this.documentNumber = documentsNumber;
    }

    @EmbeddedId
    @AttributeOverrides( {
            @AttributeOverride(name = "remoteLocate", column = @Column(name = "ACC_REMOTE_LOCATE", nullable = false, length = 2)),
            @AttributeOverride(name = "remoteHost", column = @Column(name = "ACC_REMOTE_HOST", nullable = false, length = 150)),
            @AttributeOverride(name = "remoteAddress", column = @Column(name = "ACC_REMOTE_ADDRESS", nullable = false, length = 150)),
            @AttributeOverride(name = "userAgent", column = @Column(name = "ACC_USER_AGENT", nullable = false, length = 150)),
            @AttributeOverride(name = "outDate", column = @Column(name = "ACC_END_DATE", nullable = false, length = 19)),
            @AttributeOverride(name = "date", column = @Column(name = "ACC_ACCESS_DATE", nullable = false, length = 19)) })
    public CitizenAccessId getId() {
        return this.id;
    }

    public void setId(CitizenAccessId id) {
        this.id = id;
    }

    @Column(name = "ACC_USER_NAME", nullable = false, length = 100)
    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Column(name = "ACC_DOCUMENT_NUMBER", nullable = false, length = 25)
    public String getDocumentNumber() {
        return this.documentNumber;
    }

    public void setDocumentNumber(String documentNumber) {
        this.documentNumber = documentNumber;
    }

}
